UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ufwDu/9jZBLWJJAfDvg7vAsJ+34P5781vCcAv+J0UHc=' 
WHERE 
  key_id = 'ca95ee0b6659e77b11f473c30f4686140c9dbfd969f00d666c86f9ce28e41579' 
  AND (
    token = 'ufwDu/9jZBLWJJAfDvg7vAsJ+34P5781vCcAv+J0UHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050