UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Tgz1tIZ+87uC7hROUTUKVoOaa2P4yVT28lqxfd9hivU='
WHERE
key_id = 'dfdb7493ce2b25e37e673e864a1f3f4a6c74d8df7419d9daa22830945b002ff9'
AND (
token = 'Tgz1tIZ+87uC7hROUTUKVoOaa2P4yVT28lqxfd9hivU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)