UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iBrG0N7eGW1inhCI1OMcATt7ay6UXgmfW/qkIyADM/w=' 
WHERE 
  key_id = '5b06efc04b2c78c6032eddc14d0b831d2e8dc1010d1d19783bab96233fed9654' 
  AND (
    token = 'iBrG0N7eGW1inhCI1OMcATt7ay6UXgmfW/qkIyADM/w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036