UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TO0Wkf2CQXlLgV5Jg0iKlcqLT9kXz8TjHHoHwsmfgNs=' 
WHERE 
  key_id = '9ff308026bddf69a68afeeb9d4795a57fca4c86b9416128a684a11d59159ae76' 
  AND (
    token = 'TO0Wkf2CQXlLgV5Jg0iKlcqLT9kXz8TjHHoHwsmfgNs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027