UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pVjW4GDFQ7nJHAYIjbRIN+3br7HjNFBqXcql0q7HES8='
WHERE
key_id = 'bafe6142a3332f325bee1659798f8a1f1f81dba1bbc349eb24141b1c822f3123'
AND (
token = 'pVjW4GDFQ7nJHAYIjbRIN+3br7HjNFBqXcql0q7HES8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)