UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hF+klKyvgXQHcQSb5efpNiDfmOVKi+89HZKmkU+w+y0=' 
WHERE 
  key_id = '8b95115a97297af8977609c3dc399dfd75103dcafb74eb5a508f4b9b45931d9b' 
  AND (
    token = 'hF+klKyvgXQHcQSb5efpNiDfmOVKi+89HZKmkU+w+y0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036