UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QPsLzvDdmO3YFWs5uAscDNdz2vNUZ9g9sBExq0j12QY='
WHERE
key_id = '1a0a611c4fb9518a10e3d4e9def3461ccbea82f79d0107c0779d3d0a98b03a4a'
AND (
token = 'QPsLzvDdmO3YFWs5uAscDNdz2vNUZ9g9sBExq0j12QY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)