UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dP/+7El1ci2FakXKYtIp2umgzZlOc/kjh0gm4Ou347w=' 
WHERE 
  key_id = 'f6645b66da78d887fbbc90e1c4856795867b07e4c2ff836e67a2eab8ce57e777' 
  AND (
    token = 'dP/+7El1ci2FakXKYtIp2umgzZlOc/kjh0gm4Ou347w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042