UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p1X5+3kCYprUY7jb0lPXxpjBUI3HsOzzsge+1SVXlMc=' 
WHERE 
  key_id = 'ca1dbe29fc201248a5e963e56705d1a8bf6b63404ab995fafccc276aa1225e6a' 
  AND (
    token = 'p1X5+3kCYprUY7jb0lPXxpjBUI3HsOzzsge+1SVXlMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027