UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dg0C9jl1NEJPhU0jktlwgjn+0AI+jc29QGTyl6ZufHA='
WHERE
key_id = '40659b53e054b7e040e7fa51fd24cb6d60154cb74e3203e09848efb07a976be0'
AND (
token = 'dg0C9jl1NEJPhU0jktlwgjn+0AI+jc29QGTyl6ZufHA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)