UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bpKvk5FcLgjqwAarvCCfAZF9Ock2a6urexvFyfrrjFA='
WHERE
key_id = 'afb050723d328c21c0e57b42870aaae38cfb2279ceb1cd9145f59ca7fea14e18'
AND (
token = 'bpKvk5FcLgjqwAarvCCfAZF9Ock2a6urexvFyfrrjFA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)