UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c9l6DS94SDnJbUZxLnzHl40KXkKrf+/31cU9NlYmX/M='
WHERE
key_id = 'f38a2ed57a813e51ee2ae768ac5d2c06231238c0d3a3bf79e6141b23f7e98c15'
AND (
token = 'c9l6DS94SDnJbUZxLnzHl40KXkKrf+/31cU9NlYmX/M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)