UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KL10LoblUOLu5S3GRmXu/ekByjVOGqx/8iuioULwDfM=' 
WHERE 
  key_id = '4b61b1cd9978ab851ebcc3c3e745839db12bc57da9cc0719aeda9261117d3108' 
  AND (
    token = 'KL10LoblUOLu5S3GRmXu/ekByjVOGqx/8iuioULwDfM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024