UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CqDpUopt+q/yQRnChaM7PCSheOLvhPQNJGzo1NM8S80=' 
WHERE 
  key_id = '7a56f90733491aa9f413c156e6615bff462b798ea4592599ab48ce657d4913f5' 
  AND (
    token = 'CqDpUopt+q/yQRnChaM7PCSheOLvhPQNJGzo1NM8S80=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036