UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cilgmxmRQ47HOkV42AnJRACPDjjK+EKs58FitXFF8J0=' 
WHERE 
  key_id = 'b317d7691b4656ed57517cde9117d7f70456667b24ed74b8b03fdd15782dde05' 
  AND (
    token = 'cilgmxmRQ47HOkV42AnJRACPDjjK+EKs58FitXFF8J0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045