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