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