UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2f3w8z5PyOPgfp2KwsqQBg+lD6Ry4dk6YSQ1+Iyb98w='
WHERE
key_id = 'd2f6535250183ac8a52471f2222659bccdad35b9e2fb2754ba64834538243832'
AND (
token = '2f3w8z5PyOPgfp2KwsqQBg+lD6Ry4dk6YSQ1+Iyb98w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)