UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N72RTzP3P+Jf2/TJz3PqemZB0KDcaU0sXRttD1xQrsc='
WHERE
key_id = '6e4ca2e75b0c32bd10feb91a6c0819443a7dcaa7a0532f4a24a4ae07c2e6e512'
AND (
token = 'N72RTzP3P+Jf2/TJz3PqemZB0KDcaU0sXRttD1xQrsc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)