UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ELxRZaDShhkGcOE2VEoZ46GL5+A/cgKnrsLfWAXJbjY=' 
WHERE 
  key_id = '7c030322897e82d230e875bf4d53bc505cd9e8977e723254a66b3b1878c78777' 
  AND (
    token = 'ELxRZaDShhkGcOE2VEoZ46GL5+A/cgKnrsLfWAXJbjY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034