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