UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '57nwWivs1cW2juHBXWHVBn7sm7QNh3RkMnxzcWT6E7M='
WHERE
key_id = 'dde66992bbd61e5ee44a8c9e7ce7265dcee26bf44d3388ff32103592e85c9b07'
AND (
token = '57nwWivs1cW2juHBXWHVBn7sm7QNh3RkMnxzcWT6E7M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)