UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M7j8SOBWLtdMFm2Iu43fz4vqUBIAZ87ZrbxInHWOrfE=' 
WHERE 
  key_id = 'cfd365af979c5a145dff8e0de3fff208573021d97fa84309cb448b1a353db148' 
  AND (
    token = 'M7j8SOBWLtdMFm2Iu43fz4vqUBIAZ87ZrbxInHWOrfE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038