UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p0yTn4AquIeNPGHKeGul1WrNhdDc0Qchu9qO3wasR+c='
WHERE
key_id = '42d5457f307b8cfae32c5e4ee4531e77de3d5d0ab4b65127f50115253c9db3ac'
AND (
token = 'p0yTn4AquIeNPGHKeGul1WrNhdDc0Qchu9qO3wasR+c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)