UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9qCwJM0rC+I0NV0HSgA9Y1GqUjpOuiRiuDoHFVUflHs=' 
WHERE 
  key_id = '204d5944b20edc3fd8579926b15c425c13b834927438d0a1cff2029cbad44840' 
  AND (
    token = '9qCwJM0rC+I0NV0HSgA9Y1GqUjpOuiRiuDoHFVUflHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030