UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pbBnyDVS5tFZg4WYUw+VvEXW5bDgXBarMtrQlnIg1jA='
WHERE
key_id = 'f87cb153afd546107153a71ffdf7deb075f6e4123a6d588bb053247a8975ce84'
AND (
token = 'pbBnyDVS5tFZg4WYUw+VvEXW5bDgXBarMtrQlnIg1jA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)