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