UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0KthZ4Z0rye5ufDlmkdCoM4WTTx8TCbD1iosKiQ/fXA=' 
WHERE 
  key_id = '97aab1d95087a3a0bb5c034dc16f303fd1f592fba8bdb1190dc1e63db8165784' 
  AND (
    token = '0KthZ4Z0rye5ufDlmkdCoM4WTTx8TCbD1iosKiQ/fXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056