UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'th60baD126vE2LewlMqyfIEXIUyrl032Cn7a/1/wW5w='
WHERE
key_id = '4bd6b04cf14680fcddf412c0bb67fc11a320b240124e54be75f8c7e261f897b8'
AND (
token = 'th60baD126vE2LewlMqyfIEXIUyrl032Cn7a/1/wW5w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)