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