UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VLiUiuOHQow/m7bQCzXcnA4CzDd+JUsg7WOnWNPqaW8=' 
WHERE 
  key_id = '9990ade292012336ce863f9254701226162d5a2be6ba9ab52198d6aca207f1a1' 
  AND (
    token = 'VLiUiuOHQow/m7bQCzXcnA4CzDd+JUsg7WOnWNPqaW8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036