UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iWP+nGnFvxI3p4jAYdlEIkQG7BjgqSZmfSxGm2JaOUg='
WHERE
key_id = 'dc7e93e7cc4f8bc517685eeb80d139c4efee82a629ac9840587d764a4af189f4'
AND (
token = 'iWP+nGnFvxI3p4jAYdlEIkQG7BjgqSZmfSxGm2JaOUg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)