UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WqT1X+/Bm4J/yrwapPe0zmV34Y7W3e2lUCgSFtheQV0=' 
WHERE 
  key_id = '5c10473ad04b6f9ed1a2b60e635084114ad240d14093fb0d9500dedc85d8ac60' 
  AND (
    token = 'WqT1X+/Bm4J/yrwapPe0zmV34Y7W3e2lUCgSFtheQV0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054