UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G9dqCEt61lBwGhXHcMmiVkq5/iVKA42zCbwTj64iwa4=' 
WHERE 
  key_id = 'a1e670ccb1cef802da34e8c952d71eaaacb1a545040b530742d057789058b9a9' 
  AND (
    token = 'G9dqCEt61lBwGhXHcMmiVkq5/iVKA42zCbwTj64iwa4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017