UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZcEQ/R29NDp0Gdsn6ak36IqrztievJgihO3SIxeFR2k=' 
WHERE 
  key_id = 'af45697f9db03b1db65490e366c3f49f700b9c9f5e74a310fe13595e63473840' 
  AND (
    token = 'ZcEQ/R29NDp0Gdsn6ak36IqrztievJgihO3SIxeFR2k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021