UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FsqSdAJXiO13JuDx8RWy6LgNRoUmAhst3ln3MitYLMg=' 
WHERE 
  key_id = '7385e628eaf94055a20e0679c7b2c1f627f50c8a72c504e490be8362acbd24c2' 
  AND (
    token = 'FsqSdAJXiO13JuDx8RWy6LgNRoUmAhst3ln3MitYLMg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025