UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SRXWefQJwBw38HQzVys/J+fYXRkG1b0dbVzFc3LL6SY='
WHERE
key_id = 'bfe01307592b60b6bee1eee6e82dcdab19ac0c44f383d44da9bb714c81fbe76d'
AND (
token = 'SRXWefQJwBw38HQzVys/J+fYXRkG1b0dbVzFc3LL6SY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)