UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sBfxusI/nvAyUBKc7ZKmBR9MFSXCpBvK79AbLFk2AQs=' 
WHERE 
  key_id = 'b74ffb97a249010482d1dc840df8dc90d9da3f5b7eaa2d199f8b8d1d2aea183d' 
  AND (
    token = 'sBfxusI/nvAyUBKc7ZKmBR9MFSXCpBvK79AbLFk2AQs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030