UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OsgPbxd3DVG18blm71PyFEdA2IHLZ9/IO3nZnWwal9c=' 
WHERE 
  key_id = 'cca30fd1b49b7b4ca23b614eff455be8865d8f16e836533139b0599a11a4d63d' 
  AND (
    token = 'OsgPbxd3DVG18blm71PyFEdA2IHLZ9/IO3nZnWwal9c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050