UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't+t4HdG5BsZ4A7mg5pl14VwuQZNUJfCLkfkGpS3Pf1w=' 
WHERE 
  key_id = '38083f8e7d38cdcc959c36aa06b2ac3c8265f8631ce4c2d4eced69d221526d51' 
  AND (
    token = 't+t4HdG5BsZ4A7mg5pl14VwuQZNUJfCLkfkGpS3Pf1w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019