UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W4gcFnE2SayPFaStBqQEUNTs22mzN9Y5sgqPtwA3ab4=' 
WHERE 
  key_id = '4e6c3744eae2e2c44e004ba590bdb1cbabc2c0a02ddad728b12d35163a7f867d' 
  AND (
    token = 'W4gcFnE2SayPFaStBqQEUNTs22mzN9Y5sgqPtwA3ab4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028