UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dN05iYHFyH0j9IYgwNEz9WhY+O05cO5haAEQohV+phI='
WHERE
key_id = 'e53c3e59d2ebd540e29594a9d288e5ddbdf2fa3cc56ec4ab3958aa340767cf5c'
AND (
token = 'dN05iYHFyH0j9IYgwNEz9WhY+O05cO5haAEQohV+phI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)