UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5wSszcQNqAqnJ4XQhJ46ivNsYSYbhjh6vHjWx02MeHA='
WHERE
key_id = '2093cba739fc2778392b41474733beab4e9250ea1b357fc18e941711f7fc1f56'
AND (
token = '5wSszcQNqAqnJ4XQhJ46ivNsYSYbhjh6vHjWx02MeHA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)