UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QygoUZrVhaTPcSm3aqKJa/z/etQW1EH6ijThrZzi9cI='
WHERE
key_id = '333d059fb2d0fa9d120a5bd6977b633a172f8b05fdc8540370a4d2d87e019715'
AND (
token = 'QygoUZrVhaTPcSm3aqKJa/z/etQW1EH6ijThrZzi9cI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)