UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Fp7kTmlD6soaAYzIdk5StH4fCzIAsH7ae6NlJkXzDHs='
WHERE
key_id = '50cfa65da33c4df2e639fad482d3365420caa3cb994ef5b009ff5eed49b37376'
AND (
token = 'Fp7kTmlD6soaAYzIdk5StH4fCzIAsH7ae6NlJkXzDHs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)