UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z3aRE6EkuvxAp4nzoacQgKpVolnWHbGGAwgA2Nypyso=' 
WHERE 
  key_id = '9699da77de55bd269f94ceefd07ade51650c9c187f980f8ab66c7f0b255cf68f' 
  AND (
    token = 'Z3aRE6EkuvxAp4nzoacQgKpVolnWHbGGAwgA2Nypyso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027