UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z2N6CKOqMUSExF8Qbjo0E187CJWSYDs63C9TpQumEe4='
WHERE
key_id = 'cf3e1905329f500db23becdb6f44f1eae1e97b168ef28300cbaea43784256030'
AND (
token = 'z2N6CKOqMUSExF8Qbjo0E187CJWSYDs63C9TpQumEe4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)