UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd5cXQj+NTPJcgxZWYJ4EXq3PQ+JWvtP6dX/iQhTyRuA='
WHERE
key_id = '971046b649324061848ef755f4a049d54df7c1e1b172a07a5139fd506197ee8d'
AND (
token = 'd5cXQj+NTPJcgxZWYJ4EXq3PQ+JWvtP6dX/iQhTyRuA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)