UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i9tBTh+1nYR0C+3N7MK/4U4rK4cY4rjOLss+D8dAmg8='
WHERE
key_id = '0a9a32327b5fd503596bba99d262a43977db73a147c3fba988af676c18424852'
AND (
token = 'i9tBTh+1nYR0C+3N7MK/4U4rK4cY4rjOLss+D8dAmg8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)