UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ihMS1k3BAlrZji7TUI1OdCmTs7ZZ9/ezs/vlur+d/Lo=' 
WHERE 
  key_id = '3eb74c94b8032de19dd283a0852b982e4e3443a3c0dddb13dcd60bab0bf2c8ee' 
  AND (
    token = 'ihMS1k3BAlrZji7TUI1OdCmTs7ZZ9/ezs/vlur+d/Lo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042