UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9w3iy1vAXgitmbtjdSD5hQGeqa+fuXzG6BSUbTIXF4s='
WHERE
key_id = '4d895fc00a7170bb36bc2e26447f0669df0d7162204f194102dfc2736421c77a'
AND (
token = '9w3iy1vAXgitmbtjdSD5hQGeqa+fuXzG6BSUbTIXF4s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)