UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p9D6AzdKkLukLBWLxBRUQU52YfC+L4w+H8cQ+yX2FpI='
WHERE
key_id = 'a76f75c61af96d5e981f8143f1d76b97968b261f8b7e33c7a4f9bf70f96b70ae'
AND (
token = 'p9D6AzdKkLukLBWLxBRUQU52YfC+L4w+H8cQ+yX2FpI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)