UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wrezcSq+o6WjlIeSHm5n4bwdIrTUFcebXBf0oNHiawA=' 
WHERE 
  key_id = 'ff29f624a95219730f0b0e70a3233987e731be37478f053d58d089da1287fa11' 
  AND (
    token = 'wrezcSq+o6WjlIeSHm5n4bwdIrTUFcebXBf0oNHiawA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035