UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HvBtFJ5ObJMF1hZqbnx0OFIoHuhMK3eBnN4L8jI8Wqw='
WHERE
key_id = '845f94877630379947a30bf7571c3ee3049d863574aceb2e62dff3ba2b89754b'
AND (
token = 'HvBtFJ5ObJMF1hZqbnx0OFIoHuhMK3eBnN4L8jI8Wqw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)