UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BaG9Ta37peItt9xRSR+2X/v8XR8csK7goWN9Y8lai1k=' 
WHERE 
  key_id = '1d366aa777c0b663feb05f0e622dae922852a62430396f7e80df34e8c7efbd1f' 
  AND (
    token = 'BaG9Ta37peItt9xRSR+2X/v8XR8csK7goWN9Y8lai1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018